package org.canaan.auth2.action;

import org.canaan.auth2.entity.User;
import org.canaan.auth2.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;

@RequestMapping("user")
@Controller
public class UserAction {
	private final Logger logger = LoggerFactory.getLogger(UserAction.class);
	@Autowired
	private UserService userService;

	@RequestMapping("/getuser.data")
	@ResponseBody
	public String getUser() {
		User user = (User) userService.loadUserByUsername("cheng");
		return JSON.toJSONString(user);
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

}
